package com.hht.tools.baselib

import android.content.ComponentName
import android.content.Intent
import android.graphics.drawable.Drawable

data class AppBean(
    var apkName: String,
    var apkPkg: String,
    var className: String,
    var isSysApp: Boolean = true,
    var isShowIcon: Boolean = false,
    var apkIcon: Drawable? = null,
    var apkResIcon: Int = 0,
) {

    fun getIntent(): Intent {
        val mIntent = Intent(Intent.ACTION_MAIN)
        mIntent.addCategory(Intent.CATEGORY_LAUNCHER)
        mIntent.component = ComponentName(apkPkg, className.toString())
        return mIntent
    }


    override fun toString(): String {
        return "AppBean(apkName='$apkName', apkPkg='$apkPkg',className='$className', isSysApp=$isSysApp)"
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as AppBean

        if (apkPkg != other.apkPkg) return false

        return true
    }

    override fun hashCode(): Int {
        return apkPkg.hashCode()
    }


}